define([
	'jquery',
	'backbone',
	'app'
], function( $, Backbone, App ) {

	var Home = Backbone.Model.extend({
		urlRoot: '/home',
		urlGet: '/getHome',
		urlSet: '/sethome',

		getHomes: function(  ) {
			$.ajax({
				url: this.urlRoot + this.urlGet
			})
		},

		setHome: function( params, successMethod, errorMethod, context ) {
			params.title
			this.title
			$.ajax({
				url: this.urlRoot + this.urlSet,
				type: 'POST',
				dataType: 'JSON',
				data: {
					title: params.title,
					id: params.homeId
				},
				success: function(data){
					successMethod(data)
				},
				error: function(data){
					errorMethod(data)
				}
			})
		}
	});

	return Home;
});
